﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.Change", ServerTypeId="{c717121b-f82f-4afb-a2b7-25f67522120f}")]
    public class Change : ClientObject
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public Change(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                string str = peekedName;
                if (str == null)
                {
                    return flag;
                }
                if (!(str == "ChangeType"))
                {
                    if (str == "SiteId")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["SiteId"] = reader.ReadGuid();
                        return flag;
                    }
                    if (str == "Time")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Time"] = reader.ReadDateTime();
                        return flag;
                    }
                    if (str == "ChangeToken")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ChangeToken"] = reader.Read<Microsoft.SharePoint.Client.ChangeToken>();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["ChangeType"] = reader.ReadEnum<Microsoft.SharePoint.Client.ChangeType>();
            }
            return flag;
        }

        [Remote]
        public Microsoft.SharePoint.Client.ChangeToken ChangeToken
        {
            get
            {
                base.CheckUninitializedProperty("ChangeToken");
                return (Microsoft.SharePoint.Client.ChangeToken) base.ObjectData.Properties["ChangeToken"];
            }
        }

        [Remote]
        public Microsoft.SharePoint.Client.ChangeType ChangeType
        {
            get
            {
                base.CheckUninitializedProperty("ChangeType");
                return (Microsoft.SharePoint.Client.ChangeType) base.ObjectData.Properties["ChangeType"];
            }
        }

        [Remote]
        public Guid SiteId
        {
            get
            {
                base.CheckUninitializedProperty("SiteId");
                return (Guid) base.ObjectData.Properties["SiteId"];
            }
        }

        [Remote]
        public DateTime Time
        {
            get
            {
                base.CheckUninitializedProperty("Time");
                return (DateTime) base.ObjectData.Properties["Time"];
            }
        }
    }
}

